home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 283_01 / counties.c < prev    next >
C/C++ Source or Header  |  1988-12-14  |  2KB  |  49 lines

  1. /* counties.c, 9/3/88, d.c.oshel */
  2.  
  3. #include "fafnir.h"
  4.  
  5. /* Iowa Dept.of Transportion 2-digit county codes range from 1 to 99 */
  6.  
  7. static char *counties[] = {
  8.     "Out of State",
  9.     "Adair",       "Adams",       "Allamakee",     "Appanoose",  "Audubon",  
  10.     "Benton",      "Black Hawk",  "Boone",         "Bremer",     "Buchanan", 
  11.     "Buena Vista", "Butler",      "Calhoun",       "Carroll",    "Cass",     
  12.     "Cedar",       "Cerro Gordo", "Cherokee",      "Chickasaw",  "Clarke",    
  13.     "Clay",        "Clayton",     "Clinton",       "Crawford",   "Dallas",    
  14.     "Davis",       "Decatur",     "Delaware",      "Des Moines", "Dickinson", 
  15.     "Dubuque",     "Emmet",       "Fayette",       "Floyd",      "Franklin",  
  16.     "Fremont",     "Greene",      "Grundy",        "Guthrie",    "Hamilton",  
  17.     "Hancock",     "Hardin",      "Harrison",      "Henry",      "Howard",    
  18.     "Humboldt",    "Ida",         "Iowa",          "Jackson",    "Jasper",    
  19.     "Jefferson",   "Johnson",     "Jones",         "Keokuk",     "Kossuth",   
  20.     "Lee",         "Linn",        "Louisa",        "Lucas",      "Lyon",      
  21.     "Madison",     "Mahaska",     "Marion",        "Marshall",   "Mills",     
  22.     "Mitchell",    "Monona",      "Monroe",        "Montgomery", "Muscatine", 
  23.     "O'Brien",     "Osceola",     "Page",          "Palo Alto",  "Plymouth",  
  24.     "Pocahontas",  "Polk",        "Pottawattamie", "Poweshiek",  "Ringgold",   
  25.     "Sac",         "Scott",       "Shelby",        "Sioux",      "Story",      
  26.     "Tama",        "Taylor",      "Union",         "Van Buren",  "Wapello",    
  27.     "Warren",      "Washington",  "Wayne",         "Webster",    "Winnebago",  
  28.     "Winneshiek",  "Woodbury",    "Worth",         "Wright"
  29. };
  30.  
  31.  
  32. int vcounty( char *p, int x, int y, int len )
  33. {
  34.     char buff[4];
  35.     int code;
  36.  
  37.     if (*p != ' ')
  38.     {
  39.         code = atoin( p, len );
  40.         if ( code > 0 && code < 100 )
  41.             return (1);  /* county codes 1 to 99 are valid */
  42.     }
  43.     code = select( x, y, counties, SIZE( counties ) );
  44.     sprintf( buff, "%02d", code );
  45.     memcpy( p, buff, len );
  46.     return (1);
  47. }
  48.  
  49.